import message from '@/message'
import loader from '@/loader'
import runtimeManager from '@/runtimeManager'

class MessageManager{
    constructor(){
        this.message = message
    }
    init(){
        this.message.receive('loadResource',(msg)=>{
            console.log(msg)
            const { appId }=msg;
            loader.loadResource({
                appId
            })
        })
        this.message.receive('setInitialData',(msg)=>{
            console.log(msg)
            const { pagePath,bridgeId }=msg;
            loader.setInitialData(msg.initialData)
            runtimeManager.firstRender({
                pagePath,
                bridgeId
            })
        })

    }

}
export default new MessageManager()